<!DOCTYPE html>
<html lang="en">
{% load static %}
<head>
    <meta charset="UTF-8">
    <title>**6.5 文章列表展现综合练习**</title>
    <!--引用css/bootstrap.min.css -->
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <script src="{% static 'js/vue.global.js' %}">
    </script>
</head>
<body>
<div class="container">
  <!-- 标题 title,内容 content,作者 author,价格 price,发布日期 pub_date,状态 status,操作 ---->
  <table class="table">
    <thead>
      <tr>
        <th scope="col">#</th>
        <th scope="col">标题</th>
        <th scope="col">内容</th>
        <th scope="col">作者</th>
        <th scope="col">价格</th>
        <th scope="col">发布日期</th>
        <th scope="col">状态</th>
        <th scope="col">操作</th>
      </tr>
    </thead>
    <tbody>
      <!-- 标题 title,内容 content,作者 author,价格 price,发布日期 pub_date,状态 status,操作 ---->
      {% for article in articles %}
      <tr>
        <th scope="row">{{ article.id }}</th>
        <td>{{ article.title }}</td>
        <td>{{ article.content }}</td>
        <td>{{ article.author }}</td>
        <td>{{ article.price }}</td>
        <td>{{ article.pub_date }}</td>
        <td>
          {% if article.status == 1 %}
          <span class="badge bg-primary">已发布</span>
          {% elif article.status == 0 %}
          <span class="badge bg-danger">草稿</span>
          {% endif %}
        </td>
        <td>
          <a href="#" class="btn btn-primary">编辑</a>
        </td>
      </tr>
      {% endfor %}

    </tbody>
  </table>
</div>
</body>
</html>